package cosc617_blackteam;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * @author Laura
 * Iterator of unmade orders
 */
public class UnmadeOrderIterator implements Iterator<Order> {
	private int index;
	private ArrayList<Order> orders;

	public UnmadeOrderIterator(ArrayList<Order> orders){
		this.orders = orders;
		index = 0;
	}
	
	@Override
	public boolean hasNext() {
		for (int i = index; i < orders.size(); i++){
			
			if (!orders.get(i).isReady())
				return true;
			index++;
			
		}
		return false;
	}

	@Override
	public Order next() {
		
			Order output = orders.get(index);
			index++;
			return output;
		
		//return null;
	}

	@Override
	public void remove() {
		throw new UnsupportedOperationException();

	}

}
